package card;


import java.util.ArrayList;
import java.util.List;

import core.Player;
import effect.Effect;
import effect.EffectGenerator;

	/**
	 * 
	 * @author Qw4z1
	 *
	 */
public abstract class Card {
	protected String name;
	protected String description;
	protected String imageBig;
	protected String imageSmall;
	protected String imageCard;
	protected int goldCost;
	protected int manaCost;
	protected Player owner;
	/** Effects that are on the card **/
	protected List<Effect> effects = new ArrayList<Effect>();
	protected List<String> effectsToAddOnSpawn = new ArrayList<String>();

	/**
	 * Class constructor setting name, description, icons, gold and mana cost.
	 * 
	 * @param name	The name of the card
	 * @param desc	The description of the card
	 * @param iB	Big icon for the card
	 * @param iS	Small icon for the card
	 * @param iC	Card icon for the card
	 * @param gC	Gold cost of the card
	 * @param mC	Mana cost of the card
	 */
	public Card(String name, String desc, String iB, String iS, String iC,
			int gC, int mC){
		this.name = name;
		this.description =desc;
		this.imageBig = iB;
		this.imageSmall = iS;
		this.imageCard = iC;
		this.goldCost = gC;
		this.manaCost = mC;		
	}
	
	/**
	 * Constructor for event and spell cards that doesn't have a big and small image, only a 
	 * card image.
	 * @param name
	 * @param desc
	 * @param iC
	 * @param gC
	 * @param mC
	 */
	public Card(String name, String desc, String iC, int gC, int mC){
		this.name = name;
		this.description =desc;
		this.imageCard = iC;
		this.goldCost = gC;
		this.manaCost = mC;		
	}
	
	/**
	 * Completely empty constructor
	 */
	public Card(){
		
	}
	
	/**
	 * Call when playing the card onto the board.
	 */
	public void playCard(){
		for(String s : effectsToAddOnSpawn){
			effects.add(EffectGenerator.generateEffect(s));
		}
	}
	
	
	// Getters

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}
	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}
	/**
	 * @return the iconBig
	 */
	public String getImageBig() {
		return imageBig;
	}
	/**
	 * @return the iconSmall
	 */
	public String getImageSmall() {
		return imageSmall;
	}
	/**
	 * @return the iconCard
	 */
	public String getImageCard() {
		return imageCard;
	}


	/**
	 * @return the goldCost
	 */
	public int getGoldCost() {
		return goldCost;
	}


	/**
	 * @return the manaCost
	 */
	public int getManaCost() {
		return manaCost;
	}
	
	public Player getOwner(){
		return owner;
	}
	public void setOwner(Player o){
		owner=o;
	}
	
	public boolean hasEffect(Effect e){
		return effects.contains(e);
	}
	public List<Effect> getEffects(){
		return effects;
	}
	public void addEffect(Effect e){
		effects.add(e);
	}
}
